//1.js 基本数据类型：number null boolean string undefined

//es6 symbol  代表的是独一无二的值  对象的属性 


//typeof 检测数据类型

// let str = 'hello';

let s = Symbol(1);

let s1 = Symbol(1);

console.log(s === s1);

console.log(typeof s);

//消除魔术字符串

const shapeType = {
    triangle: Symbol('triangle')
  };

function getArea(shape, options) {
    let area = 0;
  
    switch (shape) {
      case 'Triangle': // 魔术字符串
        area = .5 * options.width * options.height;
        break;
      /* ... more code ... */
    }
  
    return area;
  }
  
  getArea(shapeType.triangle, { width: 100, height: 100 }); // 魔术字符串

  getArea(shapeType.triangle, { width: 10, height: 20 }); // 魔术字符串




